package ee.ut.math.chess.base.model.chesspiece;

import java.io.Serializable;
import java.util.List;

import ee.ut.math.chess.base.model.Move;
import ee.ut.math.chess.game.model.Game;

public abstract class ChessPiece implements Serializable{

	private static final long serialVersionUID = 1L;
	protected Color color;
	private boolean isThreatening;
	private long value;

	public Color getColor() {
		return this.color; 
	}
	
	public long getValue() {
		return value;
	}

	public abstract void setInInitialPosition(boolean inInitialPosition); //needed for castling

	public abstract boolean isInInitialPosition();

	public abstract List<Move> getLegalMoves(int x, int y, Game game, boolean onlyKingThreatening);
	
	public void setThreatening(boolean isThreatening) {
		this.isThreatening = isThreatening;
	}
	
	@Override
	public String toString() {
		String baseString = color + "_" + this.getClass().getSimpleName();
		if (isThreatening) {
			return "\"" + baseString + "_T" +  "\"";
		}
		return "\"" + baseString + "\"";
	}
}
